using System;
using System.Runtime.Serialization;
using Comdiv.Extensions;
using Comdiv.Model;
using Comdiv.Model.Interfaces;
using Comdiv.Logging;
using Comdiv.Application;
using Comdiv.Persistence;
using Comdiv.Inversion;
using Comdiv.Security.Acl;
using Comdiv.Conversations;
using Comdiv.IO;
using Comdiv.Security;
using System.Linq;

namespace Comdiv.Messaging{
    public class MessageException : Exception{
        public MessageException(MessageErrorCode code): this(code, null){}
        public MessageException(MessageErrorCode code, IMessage message): this(code, message, null){}
        public MessageException(MessageErrorCode code, IMessage message, Exception inner): this("", code, message, inner){}

        public MessageException(string errorMessage, MessageErrorCode code, IMessage message, Exception inner):this(errorMessage,inner){
            this.ErrorCode = code;
            this.TargetMessage = message;
        }

        public IMessage TargetMessage { get; set; }

        public MessageErrorCode ErrorCode { get; set; }

        public MessageException() {}
        public MessageException(string message) : base(message) {}
        public MessageException(string message, Exception innerException) : base(message, innerException) {}
        protected MessageException(SerializationInfo info, StreamingContext context) : base(info, context) {}
    }
}